﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>TrafficLight: src/main/java/com/stateforge/statemachine/examples/trafficlight/Light.java Source File</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                Examples using state machines generated by StateBuilderJava
            </h1>
            <h3>
                TrafficLight: src/main/java/com/stateforge/statemachine/examples/trafficlight/Light.java Source File
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Packages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">src/main/java/com/stateforge/statemachine/examples/trafficlight/Light.java</div>  </div>
</div>
<div class="contents">
<a href="_light_8java.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a><a class="code" href="namespacecom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight.html">00001</a> <span class="keyword">package </span>com.stateforge.statemachine.examples.trafficlight;
<a name="l00002"></a>00002 
<a name="l00003"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html">00003</a> <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html">Light</a> {
<a name="l00004"></a>00004 
<a name="l00005"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#afce73229eeb94237315aca8b1de2adad">00005</a>     <span class="keyword">private</span> <span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#afce73229eeb94237315aca8b1de2adad">redDuration</a> = 1000;
<a name="l00006"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a274af77bf000a8748ccdeaa8846a15a8">00006</a>     <span class="keyword">private</span> <span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a274af77bf000a8748ccdeaa8846a15a8">yellowDuration</a> = 1000;
<a name="l00007"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a4430923140588336669c804c46281e8d">00007</a>     <span class="keyword">private</span> <span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a4430923140588336669c804c46281e8d">greenDuration</a> = 1000;
<a name="l00008"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a8f835c80735ffd96f19b4759da8da80e">00008</a>     <span class="keyword">private</span> <span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a8f835c80735ffd96f19b4759da8da80e">maxDuration</a> = 3500;
<a name="l00009"></a>00009     
<a name="l00010"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#ab6fd049738c48d39f2440f207af86b6a">00010</a>     <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#ab6fd049738c48d39f2440f207af86b6a">turnOnGreen</a>()
<a name="l00011"></a>00011     {
<a name="l00012"></a>00012         System.out.println(<span class="stringliteral">&quot;TurnOnGreen&quot;</span>);
<a name="l00013"></a>00013     }
<a name="l00014"></a>00014 
<a name="l00015"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#ae668eacc89b5f319bfdbaffd40e46637">00015</a>     <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#ae668eacc89b5f319bfdbaffd40e46637">turnOffGreen</a>()
<a name="l00016"></a>00016     {
<a name="l00017"></a>00017         System.out.println(<span class="stringliteral">&quot;TurnOffGreen&quot;</span>);
<a name="l00018"></a>00018     }
<a name="l00019"></a>00019 
<a name="l00020"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#afedeec9927d6ef6a9609d7cff19932f4">00020</a>     <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#afedeec9927d6ef6a9609d7cff19932f4">turnOnYellow</a>()
<a name="l00021"></a>00021     {
<a name="l00022"></a>00022         System.out.println(<span class="stringliteral">&quot;TurnOnYellow&quot;</span>);
<a name="l00023"></a>00023     }
<a name="l00024"></a>00024 
<a name="l00025"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a1e5b3de4dd7938c712bdeecbc8909866">00025</a>     <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a1e5b3de4dd7938c712bdeecbc8909866">turnOffYellow</a>()
<a name="l00026"></a>00026     {
<a name="l00027"></a>00027         System.out.println(<span class="stringliteral">&quot;TurnOffYellow&quot;</span>);
<a name="l00028"></a>00028     }
<a name="l00029"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#ad5db1e630df9d1264b4cf491a7a1cf1d">00029</a>     <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#ad5db1e630df9d1264b4cf491a7a1cf1d">turnOnRed</a>()
<a name="l00030"></a>00030     {
<a name="l00031"></a>00031         System.out.println(<span class="stringliteral">&quot;TurnOnRed&quot;</span>);
<a name="l00032"></a>00032     }
<a name="l00033"></a>00033 
<a name="l00034"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a826705a272cf1ae6dbb5a30cd96807e7">00034</a>     <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a826705a272cf1ae6dbb5a30cd96807e7">turnOffRed</a>()
<a name="l00035"></a>00035     {
<a name="l00036"></a>00036         System.out.println(<span class="stringliteral">&quot;TurnOffRed&quot;</span>);
<a name="l00037"></a>00037     }
<a name="l00038"></a>00038 
<a name="l00039"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#aafa2822a2d42075e0ae74ef076a2e413">00039</a>     <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#aafa2822a2d42075e0ae74ef076a2e413">setRedDuration</a>(<span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#afce73229eeb94237315aca8b1de2adad">redDuration</a>) {
<a name="l00040"></a>00040         this.redDuration = <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#afce73229eeb94237315aca8b1de2adad">redDuration</a>;
<a name="l00041"></a>00041     }
<a name="l00042"></a>00042 
<a name="l00043"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a11b17138c41d9e609149fd9ca49b483b">00043</a>     <span class="keyword">public</span> <span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a11b17138c41d9e609149fd9ca49b483b">getRedDuration</a>() {
<a name="l00044"></a>00044         <span class="keywordflow">return</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#afce73229eeb94237315aca8b1de2adad">redDuration</a>;
<a name="l00045"></a>00045     }
<a name="l00046"></a>00046 
<a name="l00047"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a34d8e34d2372a088e983a90a8b8a5212">00047</a>     <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a34d8e34d2372a088e983a90a8b8a5212">setYellowDuration</a>(<span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a274af77bf000a8748ccdeaa8846a15a8">yellowDuration</a>) {
<a name="l00048"></a>00048         this.yellowDuration = <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a274af77bf000a8748ccdeaa8846a15a8">yellowDuration</a>;
<a name="l00049"></a>00049     }
<a name="l00050"></a>00050 
<a name="l00051"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a798e83304c7efe0c6f3526ec34d47239">00051</a>     <span class="keyword">public</span> <span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a798e83304c7efe0c6f3526ec34d47239">getYellowDuration</a>() {
<a name="l00052"></a>00052         <span class="keywordflow">return</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a274af77bf000a8748ccdeaa8846a15a8">yellowDuration</a>;
<a name="l00053"></a>00053     }
<a name="l00054"></a>00054 
<a name="l00055"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a1568c0642b83b3413cfd6c06d4b5f82f">00055</a>     <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a1568c0642b83b3413cfd6c06d4b5f82f">setGreenDuration</a>(<span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a4430923140588336669c804c46281e8d">greenDuration</a>) {
<a name="l00056"></a>00056         this.greenDuration = <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a4430923140588336669c804c46281e8d">greenDuration</a>;
<a name="l00057"></a>00057     }
<a name="l00058"></a>00058 
<a name="l00059"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#aed451b2d2a3b467fddfcf3a079c7d375">00059</a>     <span class="keyword">public</span> <span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#aed451b2d2a3b467fddfcf3a079c7d375">getGreenDuration</a>() {
<a name="l00060"></a>00060         <span class="keywordflow">return</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a4430923140588336669c804c46281e8d">greenDuration</a>;
<a name="l00061"></a>00061     }
<a name="l00062"></a>00062 
<a name="l00063"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a387f7129d693e32b0bd815d69aa1bacf">00063</a>     <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a387f7129d693e32b0bd815d69aa1bacf">setMaxDuration</a>(<span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a8f835c80735ffd96f19b4759da8da80e">maxDuration</a>) {
<a name="l00064"></a>00064         this.maxDuration = <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a8f835c80735ffd96f19b4759da8da80e">maxDuration</a>;
<a name="l00065"></a>00065     }
<a name="l00066"></a>00066 
<a name="l00067"></a><a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a403a34dd9e502e0c76403b3e09eb5cee">00067</a>     <span class="keyword">public</span> <span class="keywordtype">long</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a403a34dd9e502e0c76403b3e09eb5cee">getMaxDuration</a>() {
<a name="l00068"></a>00068         <span class="keywordflow">return</span> <a class="code" href="classcom_1_1stateforge_1_1statemachine_1_1examples_1_1trafficlight_1_1_light.html#a8f835c80735ffd96f19b4759da8da80e">maxDuration</a>;
<a name="l00069"></a>00069     }
<a name="l00070"></a>00070     
<a name="l00071"></a>00071 }
</pre></div></div>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
